package com.bw.attendance.sign

import com.bw.attendance.sign.entity.SignEntity
import com.bw.attendance.sign.entity.SignResponseEntity
import com.bw.common.mvi.BaseRespository
import com.bw.network.BaseEntity
import com.bw.network.HttpType
import com.bw.network.NetWorkFactory
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import retrofit2.Retrofit

class SignRepo : BaseRespository(){

    //请求签到记录
    fun requestSignHistory(map : Map<String,Any>):Flow<BaseEntity>{
        val flow = NetWorkFactory.factory(HttpType.NONE)!!.create(ApiService::class.java)
            .requestSelSign(createBody(map))
        return flow.map { value: SignEntity -> value }
    }
    //签到
    fun requestSign(map : Map<String,Any>):Flow<BaseEntity>{
        val flow = NetWorkFactory.factory(HttpType.NONE)!!.create(ApiService::class.java)
            .requestInsertSign(createBody(map))
        return flow.map { value: SignResponseEntity -> value }
    }
}